package com.ruoyi.system.enums;


import lombok.Getter;

import java.util.ArrayList;
import java.util.List;

@Getter
public enum AssessmentStatus {
    MENTAL_HEALTH_GOOD("心理健康良好", 0L),
    WARNING_LEVEL_1("1级预警", 1L),
    WARNING_LEVEL_2("2级预警", 2L),
    WARNING_LEVEL_3("3级预警", 3L);

    private final String name;
    private final Long check;

    AssessmentStatus(String name, Long check) {
        this.name = name;
        this.check = check;
    }

    public static AssessmentStatus fromName(String name) {
        for (AssessmentStatus status : AssessmentStatus.values()) {
            if (status.getName().equals(name)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Unknown assessment status: " + name);
    }

    public static String fromCheck(Long check) {
        for (AssessmentStatus status : AssessmentStatus.values()) {
            if (status.getCheck().equals(check)) {
                return status.getName();
            }
        }
        throw new IllegalArgumentException("Unknown assessment check value: " + check);
    }

    public static List<String> list() {
        List<String> list = new ArrayList<>();
        for (AssessmentStatus status : AssessmentStatus.values()) {
            list.add(status.getName());
        }
        return list;
    }
}
